package com.kfm.jdbc.day0405;

import java.util.concurrent.atomic.AtomicInteger;

public class Demo07 {

    public static void main(String[] args) {
        MyRunnable r = new MyRunnable();
        for (int i = 0; i < 1000; i++) {
            new Thread(r).start();
        }
    }
}


class MyRunnable implements Runnable{

//    volatile int count = 0;
    AtomicInteger integer = new AtomicInteger();

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(integer.incrementAndGet());
//            count ++;
//            System.out.println(count);
        }
    }

}
